#include "../begonia.h"
#include "cstory.h"
#include "cmenu.h"

const char *storys[]={
    "",
    "It all started when Sanae, who",
    "missed her friends outside the",
    "Genkyoso, asked Hatate to try to",
    "use her ability to obtain their",
    "photos. To their surprise, in the",
    "photos they saw bullet barrages,",
    "which were previously thought to",
    "be exclusive to the Genkyoso.",
    "Yukari thought this is an anomaly",
    "which would potentially affect",
    "Gensokyo, so she sent Hatate and",
    "Aya (who had already become a",
    "friend of Hatate) out of the",
    "Boundary to investigate. However,",
    "for unknown reasons Yukari lost",
    "contact with them as soon as they",
    "got through the Boundary...",
    "",
    "Frightened of the possibility of",
    "never being able to return to the",
    "Genkyoso, yet thrilled of the",
    "oppotunity to take photos of the",
    "world outside, Aya and Hatate",
    "started their adventure.",
    "123456789012345678901234567890123"};
const int storyn=25;

void cstory::display(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    glViewport(scx,scy,scw,sch);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0,scw,0,sch, -1.0, 1.0);
	glMatrixMode(GL_MODELVIEW);
    glColor3d(0.7,0.3,0.3);
    glBegin(GL_POLYGON);
        glVertex2d(0,0);
        glVertex2d(scw,0);
        glVertex2d(scw,sch);
        glVertex2d(0,sch);
    glEnd();
    glColor3d(1.0,1.0,1.0);
    for(int i=0;i<storyn;i++)
    {
        drawstring(scw/2.0,sch-16.0*i,storys[i],0.5);
    }
    glutSwapBuffers();
}

void cstory::key(unsigned char key, int x, int y)
{
    screen=&menu;
    glutPostRedisplay();
}
